<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-spring4-4.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<html >
<head>
    <meta charset="UTF-8">
    <title>Contest Registrants - Online Judge</title>
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <link rel="stylesheet" th:href="@{/css/styles.css}" >
    <script th:src="@{/js/jquery-1.7.2.js}"></script>
    <script th:src="@{/js/gdoj.js}"></script>
</head>
<body>
<div th:replace="common::web-navbar"></div>
<div class="container">
    <div class="content" >
        <div class="content-no-sidebar">
            <div class="data-title" style="width: 100%;position: relative;text-align: center;">
                <h3 th:text="${contest.title}"></h3>
                <span>[[#{registrants}]]</span>
            </div>
            <div class="" style="">
                <table class="standings">
                    <tr class="header">
                        <th  class="id left-item">#</th>
                        <th  class="coder">
                            [[#{author}]]
                            <div style="float:right;text-align:right;padding: 0px;margin-right: 24px">[[#{nickname}]]</div>
                        </th>
                        <th  class="solved2" >[[#{rating}]]</th>
                    </tr>
                    <tr th:if="${pageInfo.size == 0}"><td class="left-item dark" colspan="32" style="text-align: left;">[[#{no-record}]]</td></tr>
                    <tr th:each="registrant,stat : ${pageInfo.list}" th:class="${stat.even}?'dark'">
                        <td class="id left-item" th:text="${(pageInfo.pageNum - 1) * pageInfo.pageSize + stat.index + 1}"></td>
                        <td class="coder">
                            <div style="float:left;">
                                <img class="mini-avatar" th:src="${registrant.user.avatar}"/>
                                <b><a th:href="@{/profile/{username}(username=${registrant.username})}" class="rated-user" th:classappend="'user-rate-' + ${registrant.user.rate} + ' user-tip'" th:user="${registrant.username}"  th:text="${registrant.username}"></a></b>
                                <span th:if="${session.session_username == registrant.username}">
                                    &nbsp;<a th:href="@{/contest/{contestId}/unregister(contestId=${contest.contest_id})}" title ="UnRegister this contest?">
                                    <img th:src="@{/img/delete.gif}"></img>
                                    </a>
                                </span>
                            </div>
                            <div style="float:right;font-size:12px;text-align:right;color: grey;margin-right: 24px">
                                <span th:title="${registrant.user.school}" th:text="${registrant.user.nickname}"></span>
                            </div>
                        </td>
                        <td class="solved2">
                            <span th:text="${registrant.rating.rating - registrant.rating.delta}"></span>
                            <span th:if="${registrant.rating.delta < 0}" style="color:red" th:text="${registrant.rating.delta}"></span>
                            <span th:if="${registrant.rating.delta > 0}" style="color:green" th:text="'+' + ${registrant.rating.delta}"></span>
                        </td>
                    </tr>

                </table>
            </div>
            <div style="margin:6px 12px;font-size:15px;">
                <div class="left"></div>
                <div class="right">
                    <a th:if="${pageInfo.hasPreviousPage == true}" th:href="@{'/contest/' + ${contest.contest_id} + '/registrants/page/' + ${pageInfo.prePage}}" style="color:#000;text-decoration: none;">&larr;</a>
                    <a th:if="${pageInfo.firstPage > 1}" th:href="@{'/contest/' + ${contest.contest_id} + '/registrants/page/1'}" style="color:#000;text-decoration: none;">1</a>
                    <span th:if="${pageInfo.firstPage > 2}"  >...</span>
                    <span th:each="nav:${pageInfo.navigatepageNums}">
                    <a th:href="@{'/contest/' + ${contest.contest_id} + '/registrants/page/' + ${nav}}" th:text="${nav}" th:if="${nav == pageInfo.pageNum}" style="font-weight: bold;color:#000;text-decoration: none;"></a>
                    <a th:href="@{'/contest/' + ${contest.contest_id} + '/registrants/page/' + ${nav}}" th:text="${nav}" th:if="${nav != pageInfo.pageNum}" style="color:#000;text-decoration: none;"></a>
                </span>
                    <span th:if="${pageInfo.lastPage < pageInfo.pages}" >...</span>
                    <a th:if="${pageInfo.pages > pageInfo.lastPage}" th:href="@{'/contest/' + ${contest.contest_id} + '/registrants/page/' + ${pageInfo.pages}}" th:text="${pageInfo.pages}" style="color:#000;text-decoration: none;"></a>
                    <a th:if="${pageInfo.hasNextPage == true}" th:href="@{'/contest/' + ${contest.contest_id} + '/registrants/page/' + ${pageInfo.nextPage}}" style="color:#000;text-decoration: none;">&rarr;</a>
                </div>
            </div>
        </div>
        </div>
    </div>
    <div th:replace="common::web-footer"></div>
    <div th:include="problem/status-pop"></div>
</div>
</body>
</html>
